package day008.homework;

import java.util.Arrays;
import java.util.Random;

public class Test02 {
    public static void main(String[] args) {
        Random r = new Random();
        int[] arr = new int[10];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = r.nextInt(1, 101);
        }
        System.out.println(Arrays.toString(arr));

        int sum = arr[0];
        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
            if (i > 0) {
                sum += arr[i];
            }
        }

        double avg = sum / arr.length;
        System.out.println("最大值：" + max + "，平均值：" + avg);
    }
}
